<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>My Homework</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link rel='stylesheet' type='text/css' media='all' href='__TMPL__Public/css/book.css' />
		<script src="__TMPL__Public/jquery/js/jquery-1.6.2.min.js" type="text/javascript" ></script>
		<script src="__TMPL__Public/jquery/js/jquery-ui-1.8.16.custom.min.js" type="text/javascript" ></script>
		<script type="text/javascript">
			$(function() {
				$(".deleteButton").click(function(event){
					var deleteBtn = $(this);
					var hw_id = deleteBtn.attr('hw_id');
				    $.get("__APP__/Edit/delete", {
						'hw_id': hw_id
					}, function(result) {
						result = JSON.parse(result);
						if(result.status == 1) {
							alert('删除成功');
							window.location = "__APP__/Index/adminMain";
						} else {
							alert('删除失败');
							alert(result.info);
						}
					});
				});
				$(".editButton").click(function(event){
						
					var editBtn = $(this);
					var hw_id = editBtn.attr('hw_id');
					window.location = "__APP__/Edit/editHomework?hw_id="+hw_id;
				    // $.get("__APP__/Edit/update", {
						// 'hw_id': hw_id
					// });
				});
				$("#lock").click(function(event){
					
					$.get("__APP__/Group/lock", {
						
					}, function(result) {
						result = JSON.parse(result);
						if(result.status == 1) {
							alert('锁定成功');
							window.location = "__APP__/Index/adminMain";
						} else {
							alert('锁定失败');
							alert(result.info);
						}
					});
				});
				$("#unlock").click(function(event){
					$.get("__APP__/Group/unlock", {
						
					}, function(result) {
						result = JSON.parse(result);
						if(result.status == 1) {
							alert('解锁成功');
							window.location = "__APP__/Index/adminMain";
						} else {
							alert('解锁失败');
							alert(result.info);
						}
					});
				});

			});

		</script>
	</head>
	<body id="threeColLayout" class="home">
		<div id="wrapper">
			<div id="header">
				<h1>My Homework -- 我的主页</h1>
				<ul id="mainNav">
					<li>
						<a href="__APP__/Index/adminMain" id="home">我的主页</a>
					</li>
					<li>
						<a href="__APP__/User/userManagement">用户管理</a>
					</li>
					
					<li>
						<a href="__APP__/Login/logout">退出</a>
					</li>
				</ul>
			</div><!-- end #header -->
			<div id="primaryContent">
				<div class="box interviews">
					<h2>作业汇总</h2>
					<div class="cbb">
						<table border="1">
							<tr>
								<th>序号</th>
								<th>作业</th>
								<th>更新时间</th>
								<th>截止时间</th>
								<th>操作</th>
							</tr>
							<volist name="homework" id="vo" key="k">
								<tr>
									<td>{$k}</td>
									<td><a href='__APP__/Rank/checkGrades?hw_id={$vo['id']}'>{$vo['head']}</a></td>
									<td>{$vo['create_time']|date="Y-m-d",###}</td>
									<td>{$vo['deadline']|date="Y-m-d",###}</td>
									<td>
									<button class="editButton" hw_id="{$vo['id']}">编辑</button>
									<button class="deleteButton" hw_id="{$vo['id']}">删除</button>

									</td>
									
									
								</tr>
							</volist>
						</table>
					</div>
				</div>
				</br></br>
				<form action="__APP__/Edit/addHomework" method="post">
					<input type="submit" value="发布作业">
				</form>
			</div>
			<!-- end #primaryContent -->
			<div id="sideContent">
				<div class="box">
					<h2>个人信息</h2>
					<div class="cbSide">
						<h3>姓名：</h3><h3>{$name}</h3>
						<br/>
						<h3>教工号：</h3><h3>{$id}</h3>
						<br/>
					</div>
				</div>
				<br />
				<if condition="$lock eq 0 ">
					<button id="lock" >锁定分组</button>	
				<else />
					<button id="unlock" >解锁分组</button>				
				</if>
				
			</div>
			<!-- end #sideContent -->
			<div id="footer"></div>
			<!-- end #footer -->
		</div><!-- end #wrapper -->
	</body>
</html>
</body> </html>